<? 

	$title="Add Album"; 
	$pageid="3";
	$accessid="a00";
	
	require("required/dbconnect.php");	
	require("required/header.php");
	require("required/function.php");
?>	
<script src="required/js/jquery-1.4.2.js"></script>
<script src="required/js/common_javascript.js"></script>
<?	
		
	if(!empty($_GET['action']))
	{
		switch($_GET['action'])
		{
			case 1:
				$msg="<div class='dw_success'>Data inserted</div>";
				break;
			case 2:
				$msg="<div class='dw_success'>Data Deleted</div>";
				break;
			case 3:
				$msg="<div class='dw_success'>Data Updated</div>";
				break;	
			default:
				$msg="";
				break;
		}
		echo "<script>displayMsg('divMsg')</script>";	
	}else{
		$msg="";
	}
	
	$get_album=mysql_query("select * from os_photoalbum order by id desc")or die(mysql_error());
	
?>

<table width="100%"  cellpadding="0" cellspacing="5" height="300">
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<script type="text/javascript" src="required/js/calendarDateInput.js"></script>		
	<td width="16%" valign="top">
		<? require("required/menu.php") ?>
	</td>
<td valign="top">
<font class="title">Gallery</font>
<div id="divMsg"><?= $msg ?></div>
<table width="100%" class="solidborder" cellpadding="2" cellspacing="1">
	<tr height="20" align="center" class="table_header" >
		<td width="3%">No</td>
		<td width="34%">Album name</td>
		<td width="22%">Category</td><td width="22%">Created Date</td>
		<td width="19%">Action</td>
	</tr>
	<?
		$no=1;
		if(mysql_num_rows($get_album)==0)
		{
	?>
	<tr>
		<td colspan="4" align="center"> - No album -</td>
	</tr>
	<?
		 }
		 else
		 { 
			while($a=mysql_fetch_array($get_album,MYSQL_ASSOC))
			{	
				if($no%2==0)
				{
					$class1="table_item_even";
					$class2="table_item_odd";
				}
				else
				{
					$class1="table_item_odd";
					$class2="table_item_even";
				}
	?>
		 <tr height="20" valign="top" class="<?= $class1 ?>"  onmouseover="this.className='table_item_mouseover'" 
                            onmouseout="this.className='<?= $class1 ?>'">
			<td><?= $no ?></td>
            <td>
			<?= $a['album_name_eng'] ?>
			</td>
            
			<td><?= getDataById("os_gallery_category","cat_name","id",$a['cat_id']) ?></td>
            <td align="center"><?= $a['add_date'] ?></td>
            <td align="center">
            	<a href="photo_album_view.php?id=<?= $a['id'] ?>"><img src="images/icons/view.gif"  border="0"/></a> 
                <a href="photo_album_edit.php?id=<?= $a['id'] ?>"><img src="images/icons/edit.gif"  border="0"/></a> 
                <a href="photo_album_delete.php?id=<?= $a['id'] ?>"><img src="images/icons/delete.gif"  border="0"/></a></td>
		</tr>
	<? 
			$no++;	
			}
		} 
	?>
	</table>
	<br>
	<input type="button" value="Add new album" class="button" onClick="window.open('photo_album_add.php','_self')">
	</td>
	
	
	</table>
<? require("required/footer.php"); ?>

